﻿using Iworld.Game.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace Iworld.Game.Service.Backstage.Export
{
    /// <summary>
    /// 牌轮输出信息
    /// </summary>
    [DataContract]
    public class GameChapterExport
    {
        public GameChapterExport(GameChapter game,bool canViewGameRound=false)
        {
            this.Tk = game.Tk;
            this.ChapterNumber = game.ChapterNumber;
            this.ActiveTime = game.ActiveTime;
            this.EndTime = game.EndTime;
            this.CurrentRoundNumber = game.CurrentRoundNumber;
            this.NextRoundNumber = game.NextRoundNumber;
            this.NextRoundLotteryTime = game.NextRoundLotteryTime;
            this.TotalRoundCount = game.TotalRoundCount;
            this.Status = game.Status;
            GameRounds = new List<GameRoundExport>();
            this.CanViewGameRound = canViewGameRound;
            if (this.CanViewGameRound)
            {
                foreach (var k in game.GameRounds)
                {
                    GameRounds.Add(new GameRoundExport(k));
                }
            }
        }

        /// <summary>
        /// 所属的某个运行时服务器的标识符
        /// </summary>
        [DataMember]
        public string Tk { set; get; }

        /// <summary>
        /// 本轮所有牌局的信息
        /// </summary>
        [DataMember]
        public List<GameRoundExport> GameRounds { get; set; }

        /// <summary>
        /// 轮号
        /// </summary>
        [DataMember]
        public int ChapterNumber { get; set; }

        /// <summary>
        /// 牌轮激活的时间
        /// </summary>
        [DataMember]
        public DateTime? ActiveTime { get; set; }

        /// <summary>
        /// 牌轮实际结束时间
        /// </summary>
        [DataMember]
        public DateTime? EndTime { get; set; }

        /// <summary>
        /// 当前开奖的局号
        /// </summary>
        [DataMember]
        public int? CurrentRoundNumber { get; set; }

        /// <summary>
        /// 下次开奖的局号
        /// </summary>
        [DataMember]
        public int? NextRoundNumber { get; set; }

        /// <summary>
        /// 下次开奖的时间
        /// </summary>
        [DataMember]
        public DateTime? NextRoundLotteryTime { get; set; }

        /// <summary>
        /// 本轮总局数
        /// </summary>
        [DataMember]
        public int TotalRoundCount { get; set; }

        /// <summary>
        /// 牌轮状态
        /// </summary>
        [DataMember]
        public GameChapterStatus Status { get; set; }

        [DataMember]
        public bool CanViewGameRound { set; get; }
    }
}
